////////////////////////////////////////////////////////////////////////////////////////////////////
/// Copyright (c) 2009 - 2010 RacoonStudios
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this
/// software and associated documentation files (the "Software"), to deal in the Software
/// without restriction, including without limitation the rights to use, copy, modify, merge,
/// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
/// to whom the Software is furnished to do so, subject to the following conditions:
/// 
/// The above copyright notice and this permission notice shall be included in all copies or
/// substantial portions of the Software.
/// 
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
/// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
/// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
/// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
/// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
/// DEALINGS IN THE SOFTWARE.
////////////////////////////////////////////////////////////////////////////////////////////////////

#pragma once
#ifndef vector3_h__
#define vector3_h__

#include "math/float4.h"

namespace Math
{
	////////////////////////////////////////////////////////////////////////////////////////////////////
	/// \class	vector3
	/// 
	/// \brief	A simple 3d vector as you should know it from other applications.
	/// 
	/// \author	khaos
	/// \date	04.12.2009
	////////////////////////////////////////////////////////////////////////////////////////////////////
	class vector3 : public float4
	{
		public:

			friend class point4;

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	vector3()
			///
			/// \brief	Default constructor. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			////////////////////////////////////////////////////////////////////////////////////////////////////
			vector3();

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	vector3(scalar x, scalar y, scalar z)
			///
			/// \brief	Constructor. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \param	[in]	x	The x coordinate. 
			/// \param	[in]	y	The y coordinate. 
			/// \param	[in]	z	The z coordinate. 
			////////////////////////////////////////////////////////////////////////////////////////////////////
			vector3(scalar x, scalar y, scalar z);

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	vector3(const float4 & rhs)
			///
			/// \brief	Constructor. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \param	[in]	rhs	The right hand side object. 
			////////////////////////////////////////////////////////////////////////////////////////////////////
			vector3(const float4 & rhs);




			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	void operator= (const vector3 & rhs)
			///
			/// \brief	Copy operator. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \param	[in]	rhs	The right hand side object. 
			////////////////////////////////////////////////////////////////////////////////////////////////////
			void operator = (const vector3 & rhs);

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	bool operator== (const vector3 & rhs) const
			///
			/// \brief	Equality operator. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \param	[in]	rhs	The right hand side object. 
			///
			/// \return	True if both vector3 are equal, otherwise false.
			////////////////////////////////////////////////////////////////////////////////////////////////////
			bool operator == (const vector3 & rhs) const;

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	bool operator!= (const vector3 & rhs) const
			///
			/// \brief	Inequality operator. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \param	[in]	rhs	The right hand side object. 
			///
			/// \return	True if both vector3 are inequal, otherwise false.
			////////////////////////////////////////////////////////////////////////////////////////////////////
			bool operator != (const vector3 & rhs) const;

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	void operator*=(scalar s)
			///
			/// \brief	Assignment by muliplication operator. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \param	[in]	s	The multiplication factor. 
			////////////////////////////////////////////////////////////////////////////////////////////////////
			void operator *=(scalar s);

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	void operator+= (const vector3 & rhs)
			///
			/// \brief	Assignment by addition operator. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \param	[in]	rhs	The right hand side object. 
			////////////////////////////////////////////////////////////////////////////////////////////////////
			void operator += (const vector3 & rhs);

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	void operator-= (const vector3 & rhs)
			///
			/// \brief	Assignment by subtraction operator. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \param	[in]	rhs	The right hand side object. 
			////////////////////////////////////////////////////////////////////////////////////////////////////
			void operator -= (const vector3 & rhs);

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	vector3 operator+ (const vector3 & rhs) const
			///
			/// \brief	Addition operator. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \param	[in]	rhs	The right hand side object. 
			///
			/// \return	The resulting vector3.
			////////////////////////////////////////////////////////////////////////////////////////////////////
			vector3 operator + (const vector3 & rhs) const;

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	vector3 operator- (const vector3 & rhs) const
			///
			/// \brief	Subtraction operator. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \param	[in]	rhs	The right hand side object. 
			///
			/// \return	The resulting vector3.
			////////////////////////////////////////////////////////////////////////////////////////////////////
			vector3 operator - (const vector3 & rhs) const;

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	vector3 operator* (scalar s) const
			///
			/// \brief	Muliplication operator. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \param	[in]	s	The multiplication factor. 
			///
			/// \return	The resulting vector3.
			////////////////////////////////////////////////////////////////////////////////////////////////////
			vector3 operator * (scalar s) const;

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	vector3 operator- () const
			///
			/// \brief	Inverting operator. 
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \return	The resulting vector3.
			////////////////////////////////////////////////////////////////////////////////////////////////////
			vector3 operator - () const;




			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	void set(scalar x, scalar y, scalar z)
			///
			/// \brief	Sets the x, y and z coordinates.
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \param	[in]	x	The x coordinate. 
			/// \param	[in]	y	The y coordinate. 
			/// \param	[in]	z	The z coordinate. 
			////////////////////////////////////////////////////////////////////////////////////////////////////
			void set(scalar x, scalar y, scalar z);






			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	static vector3 nullvec()
			///
			/// \brief	Returns a null vector3.
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \return	A null vector3.
			////////////////////////////////////////////////////////////////////////////////////////////////////
			static vector3 nullvec();

			////////////////////////////////////////////////////////////////////////////////////////////////////
			/// \fn	static vector3 upvec()
			///
			/// \brief	Returns an up directed vector3.
			///
			/// \author	khaos
			/// \date	06.12.2009
			///
			/// \return	Up directed vector3.
			////////////////////////////////////////////////////////////////////////////////////////////////////
			static vector3 upvec();

		protected:
			
		private:

	};

}

#endif // vector3_h__